New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@paprika/list-box

Package Overview
Dependencies
Maintainers
5
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paprika/list-box

The ListBox component allows users to select one or more options from a list contained within the component

  • 1.3.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-34.49%
Maintainers
5
Weekly downloads
 
Created
Source

@paprika/list-box - 1.2.1-alpha.3

Description

The ListBox component allows users to select one or more options from a list contained within the component

Installation

yarn add @paprika/list-box

or with npm:

npm install @paprika/list-box

Props

ListBox

PropTyperequireddefaultDescription
childrennodetrue-Child of type <ListBox.Option />, <ListBox.Divider />, etc
hasImplicitAllboolfalse-Has implicit "All items selected" value when no item is selected
heightnumbertrue-Indicate which is the height for the options container
isDisabledboolfalse-Disables the ListBox if true
isInlineboolfalse-This options will display the list-box without the Popover
isMultiboolfalse-Let the user to select multiple options at same time
isOpenboolfalse-Indicates if the popover is visible
onChangefuncfalse-Callback returning the current selection on the ListBox
placeholderstringtrue-Defaults label to display when the ListBox has not option selected
size[ ListBoxContainer.types.size.SMALL, ListBoxContainer.types.size.MEDIUM, ListBoxContainer.types.size.LARGE]false-Size of the trigger and options (font size, height, padding, etc).

Box

PropTyperequireddefaultDescription
childrennodetrue-Body content of the box.

ListBox.Divider

PropTyperequireddefaultDescription
isDisabledboolfalsetrueisDisable is use internally as a default prop

the prop is read by the option/helpers/optionState.js which is assigned in the store it helps to ignore the divider while using the keyboard. see: options/helpers/options.js| |children|node|false|null| |

ListBox.Filter

PropTyperequireddefaultDescription
a11yTextstringfalsenullDescriptive a11y text for assistive technologies. By default, text from children node will be used.
filterfuncfalsenullFilters the list
hasSearchIconboolfalsetrueIf true displays a search icon
noResultsMessagestringfalsenullMessage displayed if no results are found
onChangeFilterfuncfalsenullCallback to be executed when the value is changed
onKeyDownfuncfalsenullCallback to be executed when a key is pressed
placeholderstringfalsenullDisplays a placeholder
renderFilterfuncfalsenullRender function for filter
valuestringfalsenullSets a value for filter

ListBox.Footer

PropTyperequireddefaultDescription
isAcceptVisibleboolfalsetrueIf true it makes the accept button visible
isCancelVisibleboolfalsetrueIf true it makes the cancel button visible
isClearVisibleboolfalsetrueIf true it makes the clear button visible
isDisabledboolfalsefalseIf true it makes the footer disabled
kindAccept[ Button.types.kind.PRIMARY, Button.types.kind.MINOR]falseButton.types.kind.PRIMARYSets what kind the accept button will be
kindCancel[ Button.types.kind.PRIMARY, Button.types.kind.MINOR]falseButton.types.kind.MINORSets what kind the cancel button will be
kindClear[ Button.types.kind.PRIMARY, Button.types.kind.MINOR]falseButton.types.kind.MINORSets what kind the cancel button will be
labelAcceptstringfalsenullSets the label for the accept button
labelCancelstringfalsenullSets the label for the cancel button
labelClearstringfalsenullSets the label for the clear button
onClickAcceptfuncfalsenullCallback to be executed when the accept button is clicked or activated by keyboard.
onClickCancelfuncfalsenullCallback to be executed when the cancel button is clicked or activated by keyboard.
onClickClearfuncfalsenullCallback to be executed when the clear button is clicked or activated by keyboard.
renderExtraButtonfuncfalse() => {}Render an extra button beside the clear button
size[ Button.types.size.SMALL, Button.types.size.MEDIUM, Button.types.size.LARGE]falseButton.types.size.SMALLDetermines the size of the footer

ListBox.Option

PropTyperequireddefaultDescription
children[node,func]true-String, number or JSX content
isSelectedboolfalsenull
defaultIsSelectedboolfalsenullDescribe if the option started as selected or not
isDisabledboolfalsefalseDescribe if the option is enable or not
isHiddenboolfalsefalseDescribe if the option is hidden or not
labelstringfalsenullWhen the children are not a String, label should need to be add so the filter can work
onClickfuncfalsenullCallback for the clicking event
valueanyfalsenullValue of your option this can be any data structure
preventDefaultOnSelectboolfalsefalseInternal prop, which shouldn't be documented

ListBox.Popover

PropTyperequireddefaultDescription
childrennodefalse-Body content of the PopOver.
zIndexnumberfalse100Sets the z-index value of the PopOver

ListBox.RawItem

PropTyperequireddefaultDescription
preventDefaultOnSelectboolfalsetrue

ListBox.Trigger

PropTyperequireddefaultDescription
clearIconnodefalsenullCustom clear icon
children[node,func]false<React.Fragment />Body content of the trigger.
hasClearButtonboolfalsetrueIf true it adds a clear button
hasImplicitAllboolfalsefalseHas implicit "All items selected" value when no item is selected
labelstringfalsenullOverride the label with a custom one.
onClickClearfuncfalsenullCallback to be executed when the clear button is clicked or activated by keyboard.
onClickFooterAcceptfuncfalsenullCallback to be executed when the accept button is clicked or activated by keyboard.
placeholderstringfalse"Select..."Sets a placeholder for the trigger
isHiddenboolfalsefalseIf true the trigger will be hidden

WithTags

PropTyperequireddefaultDescription
childrenarrayOftrue-Child of type <ListBox.Option />, <ListBox.Divider />, etc
filterfuncfalseundefinedfilter function for the ListBoxWithTags can be pair with ListBoxWithTags.filter
noResultsMessagenodefalsenullString message to be display when there are not results
onChangefuncfalse() => {}Callback whenever the user change a selection on the ListBoxWithTags
onAddCustomOptionfuncfalsenullCallback whenever the user input a new custom option like some@email.com, pass undefined to ignore this behaviour
onRemovefuncfalse() => {}Callback once a pill is remove from the Trigger
customOptionRegexinstanceOffalse/^.+@.+..+$/Regex that match the input of the user and reports to onAddCustomOption. The default is a basic email regex
renderPillfuncfalsenullRender prop to override the default Pill style, see example for it's uses.
selectedOptionsarrayOffalsenullAn array of id that helps the ListBoxWithTags to known what elements are selected
pillLabelKeystringfalsenullProvides an alternative for rendering the Pill label instead of using the default [{label:value}] coming from the og data
allOptionsAreSelectedboolfalsefalseWhen this is true, it will display a message indicating all options are selected without showing the popover nor the search input
allOptionsAreSelectedMessagestringfalse""Message to display when all options have been selected

For a basic ListBox

import ListBox from "@paprika/list-box";

function Component() {
  return (
    <ListBox onChange={changeHandler}>
      <ListBox.Option>Option 1</ListBox.Option>
      <ListBox.Option>Option 2</ListBox.Option>
    </ListBox>
  );
}

With Filter

import ListBox from "@paprika/list-box";

function Component() {
  return (
    <ListBox onChange={changeHandler}>
      <ListBox.Filter />
      <ListBox.Option>Option 1</ListBox.Option>
      <ListBox.Option>Option 2</ListBox.Option>
    </ListBox>
  );
}

FAQs

Package last updated on 09 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc